package com.bootdo.config;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Map;

/*import org.elasticsearch.client.transport.TransportClient;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.transport.InetSocketTransportAddress;
import org.elasticsearch.transport.client.PreBuiltTransportClient;*/
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 
 * 
 * @author haojiangbo
 *
 */
//@Configuration
public class EsConfig {
	/*
	public static Logger log = LoggerFactory.getLogger(EsConfig.class);
	
	public EsConfig(){
		log.debug("esConfig初始化成功");
	}
	*//**
	 * IP
	 *//*
	@Value("${spring.es.host}")
	private String host;
	*//**
	 * 端口
	 *//*
	@Value("${spring.es.port}")
	private Integer port;
	
	
	@Bean
	public TransportClient getTransportClient() throws UnknownHostException{
		log.warn("es client初始化 host = {} port = {}",host,port);
		System.setProperty("es.set.netty.runtime.available.processors", "false");
		Map map = new HashMap<>();
		map.put("cluster.name","docker-cluster");
		Settings settings = Settings.builder().put(map).build();
		return new PreBuiltTransportClient(settings).addTransportAddresses(
                new InetSocketTransportAddress(InetAddress.getByName(host),port));	
	}*/
	
	
}
